package com.ly.heart.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ly.common.annotation.Excel;
import com.ly.common.core.domain.BaseVo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * <p>
 * 合同、申请、订单、出入库明细清单表，关联物料信息
 * </p>
 * @author WuZH
 * @since 2024-05-14
 */
@Getter
@Setter
@Data
@Accessors (chain = true)
@TableName ("erp_material_detail_info")
@ApiModel (value = "物料信息明细清单表", description = "物料信息明细清单表")
public class MaterialDetailEntity extends BaseVo {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty ("id")
    @TableId (value = "id", type = IdType.INPUT)
    private String id;

    @ApiModelProperty ("订单Id/出入库单Id")
    @TableField ("relation_id")
    private String relationId;

    @ApiModelProperty ("源关联id(采购合同id/采购订单id/采购申请单id/销售订单id/询价单id/销售报价单id)")
    @TableField ("source_relation_id")
    private String sourceRelationId;

    @ApiModelProperty ("源单物料明细id（选单时物料明细id，不是物料id）")
    @TableField ("source_material_detail_id")
    private String sourceMaterialDetailId;

    @ApiModelProperty ("行号")
    @TableField ("line_number")
    private String lineNumber;

    @ApiModelProperty ("类型；\n" +
            "1：采购订单；\n" +
            "2：销售订单；\n" +
            "3：采购询价（该类型不同，改用其他业务表）；\n" +
            "4：采购报价（该类型不同，改用其他业务表）；\n" +
            "5：采购合同物料明细；\n" +
            "6：采购申请单；\n" +
            "7：调拨明细；\n" +
            "8：销售合同物料明细;\n" +
            "9：销售报价单 \n" +
            "10:采购订单新变更单")
    @TableField ("type")
    private Integer type;

    @ApiModelProperty ("物料Id")
    @TableField ("material_id")
    private String materialId;

    @ApiModelProperty ("物料编码，取自物料基础表，前端带过来")
    @TableField ("material_code")
    private String materialCode;

    @ApiModelProperty ("合同数量/销售数量")
    @TableField ("number")
    private String number;

    @ApiModelProperty ("仓库id")
    @TableField ("warehouse_id")
    private String warehouseId;

    @ApiModelProperty ("仓库code")
    @TableField ("warehouse_code")
    private String warehouseCode;

    @ApiModelProperty ("仓库区域id")
    @TableField ("warehouse_region_id")
    private String warehouseRegionId;

    @ApiModelProperty ("库存id")
    @TableField ("inventory_id")
    private String inventoryId;

    @ApiModelProperty ("含税单价")
    @TableField ("tax_price")
    private String taxPrice;

    @ApiModelProperty ("税率")
    @TableField ("tax_rate")
    private String taxRate;

    @ApiModelProperty ("不含税金额")
    @TableField ("no_tax_money")
    private String noTaxMoney;

    @ApiModelProperty ("含税金额")
    @TableField ("tax_money")
    private String taxMoney;

    @ApiModelProperty ("备注")
    @TableField ("ramarks")
    private String ramarks;

    @ApiModelProperty ("创建时间")
    @TableField ("create_time")
    @JsonFormat (pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @ApiModelProperty ("更新时间")
    @TableField ("change_time")
    @JsonFormat (pattern = "yyyy-MM-dd HH:mm:ss")
    private Date changeTime;

    @TableField ("is_used")
    private Integer isUsed;

    @ApiModelProperty ("采购单位/销售单位")
    @TableField ("purchase_unit")
    @Excel (name = "采购单位/销售单位")
    private String purchaseUnit;

    @ApiModelProperty ("计价单位")
    @TableField ("pricing_unit")
    @Excel (name = "计价单位")
    private String pricingUnit;

    @ApiModelProperty ("计价数量")
    @TableField ("pricing_num")
    @Excel (name = "计价数量")
    private String pricingNum;

    @ApiModelProperty ("交货日期/销售是要货日期")
    @TableField ("delivery_date")
    @JsonFormat (pattern = "yyyy-MM-dd")
    @Excel (name = "交货日期/销售是要货日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date deliveryDate;

    @ApiModelProperty ("交货地点")
    @TableField ("delivery_location")
    @Excel (name = "交货地点")
    private String deliveryLocation;

    @ApiModelProperty ("交货地址")
    @TableField ("delivery_address")
    @Excel (name = "交货地址")
    private String deliveryAddress;

    @ApiModelProperty ("单价")
    @TableField ("price")
    @Excel (name = "单价")
    private String price;

//    @ApiModelProperty ("含税单价")
//    @TableField ("contains_tax_price")
//    @Excel (name = "含税单价")
//    private String containsTaxPrice;

    @ApiModelProperty ("折扣率")
    @TableField ("discount_rate")
    @Excel (name = "折扣率")
    private String discountRate;

    @ApiModelProperty ("折扣额")
    @TableField ("discount_amount")
    @Excel (name = "折扣额")
    private String discountAmount;

    @ApiModelProperty ("净价")
    @TableField ("net_amount")
    @Excel (name = "净价")
    private String netAmount;

    @ApiModelProperty ("税额")
    @TableField ("tax_amount")
    @Excel (name = "税额")
    private String taxAmount;

    @ApiModelProperty ("价税合计")
    @TableField ("total_tax_price")
    @Excel (name = "价税合计")
    private String totalTaxPrice;

    /**
     * 金额
     */
    @ApiModelProperty ("金额")
    @TableField ("amount_money")
    @Excel (name = "金额")
    private String amountMoney;

    @ApiModelProperty ("需求组织，销售合同明细该字段叫：采购组织")
    @TableField ("require_dept")
    @Excel (name = "需求组织")
    private String requireDept;

    @ApiModelProperty ("收料组织")
    @TableField ("receiving_dept")
    @Excel (name = "收料组织")
    private String receivingDept;

    @ApiModelProperty ("结算组织")
    @TableField ("settlement_dept")
    @Excel (name = "结算组织")
    private String settlementDept;

    @ApiModelProperty ("是否赠品")
    @TableField ("is_giveaway")
    @Excel (name = "是否赠品")
    private Boolean isGiveaway;

    @ApiModelProperty ("供应商物料编码")
    @TableField ("supplier_material_code")
    @Excel (name = "供应商物料编码")
    private String supplierMaterialCode;

    @ApiModelProperty ("供应商物料名称")
    @TableField ("supplier_material_name")
    @Excel (name = "供应商物料名称")
    private String supplierMaterialName;

    @ApiModelProperty ("库存单位")
    @TableField ("inventory_unit")
    @Excel (name = "库存单位")
    private String inventoryUnit;

    @ApiModelProperty ("库存数量")
    @TableField ("inventory_num")
    @Excel (name = "库存数量")
    private Integer inventoryNum;

    @ApiModelProperty ("批号")
    @TableField ("batch_num")
    @Excel (name = "批号")
    private String batchNum;

    @ApiModelProperty ("源单类型(0采购合同 1采购申请单 2销售订单 3询价单 4采购订单)")
    @TableField ("source_doc_type")
    @Excel (name = "源单类型(0采购合同 1采购申请单 2销售订单 3询价单 4采购订单)")
    private String sourceDocType;

    @ApiModelProperty ("源单编号")
    @TableField ("source_doc_code")
    @Excel (name = "源单编号")
    private String sourceDocCode;

    @ApiModelProperty ("累计验收金额")
    @TableField ("total_acceptance_amount")
    @Excel (name = "累计验收金额")
    private String totalAcceptanceAmount;

    @ApiModelProperty ("累计验收比例")
    @TableField ("total_acceptance_rate")
    @Excel (name = "累计验收比例")
    private String totalAcceptanceRate;

    @ApiModelProperty ("先收票数量(库存基本)")
    @TableField ("received_first_tickets_num")
    @Excel (name = "先收票数量(库存基本)")
    private String receivedFirstTicketsNum;

    @ApiModelProperty ("业务含税单价")
    @TableField ("business_tax_price")
    @Excel (name = "业务含税单价")
    private String businessTaxPrice;

    @ApiModelProperty ("业务单价")
    @TableField ("business_price")
    @Excel (name = "业务单价")
    private String businessPrice;

    @ApiModelProperty ("物料执行状态（0待执行 1已完成）")
    @TableField ("execute_status")
    @Excel (name = "物料执行状态（0待执行 1已完成）")
    private String executeStatus;

    @ApiModelProperty ("变更类型（0新增 1修改 2删除）")
    @TableField ("change_type")
    @Excel (name = "变更类型（0新增 1修改 2删除）")
    private String changeType;

    @ApiModelProperty ("父项产品")
    @TableField ("parent_material")
    @Excel (name = "父项产品")
    private String parentMaterial;

    @ApiModelProperty ("原采购数量")
    @TableField ("original_number")
    @Excel (name = "原采购数量")
    private String originalNumber;

    @ApiModelProperty ("原含税单价")
    @TableField ("original_contains_tax_price")
    @Excel (name = "原含税单价")
    private String originalContainsTaxPrice;

    /**
     * 所属公司
     */
    @ApiModelProperty("所属公司")
    @TableField("dept_id")
    @Excel(name = "所属公司")
    private String deptId;

    /**
     * 流程实例id
     */
    @ApiModelProperty ("流程实例id")
    @TableField ("instance_id")
    @Excel (name = "流程实例id")
    private String instanceId;

    @ApiModelProperty ("货主")
    @TableField ("cargo_owner")
    @Excel (name = "货主")
    private String cargoOwner;

    @ApiModelProperty ("货主类型")
    @TableField ("cargo_owner_type")
    @Excel (name = "货主类型")
    private String cargoOwnerType;

    /**
     * 审核状态
     */
    @ApiModelProperty ("审核状态")
    @TableField ("state")
    @Excel (name = "审核状态")
    private String state;

    @ApiModelProperty ("业务type")
    @TableField (exist = false)
    private String businessType;

    @ApiModelProperty ("流程模型id")
    @TableField (exist = false)
    private String modelId;

    @ApiModelProperty ("物料基础信息")
    @TableField (exist = false)
    private MaterialEntity material;

    @ApiModelProperty ("采购订单交货安排信息")
    @TableField (exist = false)
    private OrderDeliveryEntity orderDelivery;


    @ApiModelProperty ("销售订单交货计划明细")
    @TableField (exist = false)
    private SaleOrderDeliveryEntity saleOrderDelivery;

    @ApiModelProperty ("采购订单其他信息")
    @TableField (exist = false)
    private OrderOtherEntity orderOther;

    @ApiModelProperty ("采购订单明细财务信息")
    @TableField (exist = false)
    private OrderFinanceDetailEntity orderFinanceDetail;

    @ApiModelProperty ("销售订单变更单明细新数据存在原始对象中")
    @TableField (exist = false)
    private MaterialDetailEntity materialChangeEntity;

    @ApiModelProperty ("物料名称")
    @TableField (exist = false)
    private String materialName;

    @ApiModelProperty ("采购单位名称")
    @TableField (exist = false)
    private String purchaseUnitName;

    @ApiModelProperty ("库存单位名称")
    @TableField (exist = false)
    private String inventoryUnitName;

    @ApiModelProperty ("计价单位")
    @TableField (exist = false)
    private String pricingUnitName;

    @ApiModelProperty ("规格型号")
    @TableField (exist = false)
    private String model;

    @ApiModelProperty ("需求组织")
    @TableField (exist = false)
    private String requireDeptName;

    @ApiModelProperty ("收料组织")
    @TableField (exist = false)
    private String receivingDeptName;

    @ApiModelProperty ("结算组织")
    @TableField (exist = false)
    private String settlementDeptName;

    @ApiModelProperty ("仓库名称")
    @TableField (exist = false)
    private String warehouseName;


}
